//关闭AJAX相应的缓存，即清除JSON浏览器缓存
$.ajaxSetup ({
    cache: false //关闭AJAX相应的缓存
});
//手动加载JSON数据
var LoadJson = function (result,url){
	$.ajax({
		type: "GET",
		dataType:"json",
        url:url,
        async: false,
        success: function(data){
        	data = eval(data);
        	$.each(data, function(i,obj){
        		result.push(obj);
        	});
        }
	});
};
//扩展jQuery对json字符串的转换
jQuery.extend({
	/** * @see 将json字符串转换为对象 * @param json字符串 * @return 返回object,array,string等对象 */ 
	evalJSON: function(strJson) {
		return eval("(" + strJson + ")");  
	}
});
jQuery.extend({
/** * @see 将javascript数据类型转换为json字符串 * @param 待转换对象,支持object,array,string,function,number,boolean,regexp * @return 返回json字符串 */
	toJSON: function(object,type) {
		 if(!type)
		 type = typeof object;
		 switch (type) { 
			 case 'undefined':
			 case 'unknown':
				 return;
			     break; 
			 case 'function':
		     case 'boolean':
			 case 'regexp':
				 return object.toString(); 
				 break; 
			 case 'number':  
				 return isFinite(object) ? object.toString() : 'null';
			     break; 
			 case 'string': 
				 return '"' + object.replace(/(\\|\")/g, "\\$1").replace(/\n|\r|\t/g, function() {
					 var a = arguments[0]; 
					 return (a == '\n') ? '\\n': (a == '\r') ? '\\r': (a == '\t') ? '\\t': ""
				 }) + '"';
				 break; 
			 case 'object':
				 if (object === null) return 'null';
			     var results = []; 
				 for (var property in object) {
					 var value = jQuery.toJSON(object[property]);  
					 if (value !== undefined) results.push(jQuery.toJSON(property) + ':' + value);
				 }
				 return '{' + results.join(',') + '}';
				 break; 
			 case 'array':
				 var results = [];
			     for (var i = 0; i < object.length; i++) {
					 var value = jQuery.toJSON(object[i]);
					 if (value !== undefined) results.push(value);
				 }
                 return '[' + results.join(',') + ']';
				 break;
		 }
	}
});